namespace SilverSea.Untilities
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Drawing;
    using System.Windows.Forms;

    public class PrintOptions : Form
    {
        protected Button btnCancel;
        protected Button btnOK;
        private CheckBox chkFitToPageWidth;
        internal CheckedListBox chklst;
        private CheckBox chkShowPaperSettings;
        private IContainer icontainer_0;

        public PrintOptions()
        {
            this.InitializeComponent();
        }

        public PrintOptions(List<string> availableFields)
        {
            this.InitializeComponent();
            foreach (string str in availableFields)
            {
                this.chklst.Items.Add(str, true);
            }
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            base.DialogResult = DialogResult.Cancel;
            base.Close();
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            if (this.GetSelectedColumns().Count == 0)
            {
                MessageBox.Show("Bạn phải chọn \x00edt nhất 1 cột.", "Th\x00f4ng b\x00e1o", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else
            {
                base.DialogResult = DialogResult.OK;
                base.Close();
            }
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.icontainer_0 != null))
            {
                this.icontainer_0.Dispose();
            }
            base.Dispose(disposing);
        }

        public List<string> GetSelectedColumns()
        {
            List<string> list = new List<string>();
            foreach (object obj2 in this.chklst.CheckedItems)
            {
                list.Add(obj2.ToString());
            }
            return list;
        }

        private void InitializeComponent()
        {
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PrintOptions));
            this.chkFitToPageWidth = new System.Windows.Forms.CheckBox();
            this.btnOK = new System.Windows.Forms.Button();
            this.btnCancel = new System.Windows.Forms.Button();
            this.chklst = new System.Windows.Forms.CheckedListBox();
            this.chkShowPaperSettings = new System.Windows.Forms.CheckBox();
            this.SuspendLayout();
            // 
            // chkFitToPageWidth
            // 
            this.chkFitToPageWidth.AutoSize = true;
            this.chkFitToPageWidth.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F);
            this.chkFitToPageWidth.Location = new System.Drawing.Point(12, 320);
            this.chkFitToPageWidth.Name = "chkFitToPageWidth";
            this.chkFitToPageWidth.Size = new System.Drawing.Size(94, 17);
            this.chkFitToPageWidth.TabIndex = 21;
            this.chkFitToPageWidth.Text = "Vừa trang giấy";
            this.chkFitToPageWidth.UseVisualStyleBackColor = true;
            // 
            // btnOK
            // 
            this.btnOK.BackColor = System.Drawing.SystemColors.Control;
            this.btnOK.Cursor = System.Windows.Forms.Cursors.Default;
            this.btnOK.Font = new System.Drawing.Font("Arial", 8.25F);
            this.btnOK.ForeColor = System.Drawing.SystemColors.ControlText;
            this.btnOK.Image = ((System.Drawing.Image)(resources.GetObject("btnOK.Image")));
            this.btnOK.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
            this.btnOK.Location = new System.Drawing.Point(146, 330);
            this.btnOK.Name = "btnOK";
            this.btnOK.RightToLeft = System.Windows.Forms.RightToLeft.No;
            this.btnOK.Size = new System.Drawing.Size(75, 26);
            this.btnOK.TabIndex = 14;
            this.btnOK.Text = "Đồng ý";
            this.btnOK.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            this.btnOK.UseVisualStyleBackColor = true;
            this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
            // 
            // btnCancel
            // 
            this.btnCancel.BackColor = System.Drawing.SystemColors.Control;
            this.btnCancel.Cursor = System.Windows.Forms.Cursors.Default;
            this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
            this.btnCancel.Font = new System.Drawing.Font("Arial", 8.25F);
            this.btnCancel.ForeColor = System.Drawing.SystemColors.ControlText;
            this.btnCancel.Image = ((System.Drawing.Image)(resources.GetObject("btnCancel.Image")));
            this.btnCancel.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
            this.btnCancel.Location = new System.Drawing.Point(227, 330);
            this.btnCancel.Name = "btnCancel";
            this.btnCancel.RightToLeft = System.Windows.Forms.RightToLeft.No;
            this.btnCancel.Size = new System.Drawing.Size(75, 26);
            this.btnCancel.TabIndex = 15;
            this.btnCancel.Text = "Hủy bỏ";
            this.btnCancel.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            this.btnCancel.UseVisualStyleBackColor = true;
            this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
            // 
            // chklst
            // 
            this.chklst.CheckOnClick = true;
            this.chklst.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold);
            this.chklst.FormattingEnabled = true;
            this.chklst.Location = new System.Drawing.Point(12, 10);
            this.chklst.Name = "chklst";
            this.chklst.Size = new System.Drawing.Size(290, 304);
            this.chklst.TabIndex = 13;
            // 
            // chkShowPaperSettings
            // 
            this.chkShowPaperSettings.AutoSize = true;
            this.chkShowPaperSettings.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F);
            this.chkShowPaperSettings.Location = new System.Drawing.Point(12, 342);
            this.chkShowPaperSettings.Name = "chkShowPaperSettings";
            this.chkShowPaperSettings.Size = new System.Drawing.Size(93, 17);
            this.chkShowPaperSettings.TabIndex = 22;
            this.chkShowPaperSettings.Text = "Cài đặt máy in";
            this.chkShowPaperSettings.UseVisualStyleBackColor = true;
            // 
            // PrintOptions
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.BackColor = System.Drawing.SystemColors.Control;
            this.CancelButton = this.btnCancel;
            this.ClientSize = new System.Drawing.Size(314, 368);
            this.Controls.Add(this.chkShowPaperSettings);
            this.Controls.Add(this.chkFitToPageWidth);
            this.Controls.Add(this.btnOK);
            this.Controls.Add(this.btnCancel);
            this.Controls.Add(this.chklst);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
            this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
            this.MaximizeBox = false;
            this.MinimizeBox = false;
            this.Name = "PrintOptions";
            this.ShowInTaskbar = false;
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
            this.Text = "Tùy chọn In";
            this.Load += new System.EventHandler(this.PrintOptions_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        private void PrintOptions_Load(object sender, EventArgs e)
        {
        }

        public bool FitToPageWidth
        {
            get
            {
                return this.chkFitToPageWidth.Checked;
            }
            set
            {
                this.chkFitToPageWidth.Checked = value;
            }
        }

        public bool HidePageSettingOption
        {
            set
            {
                this.chkFitToPageWidth.Visible = !value;
                this.chkShowPaperSettings.Visible = !value;
            }
        }

        public bool ShowPageSettings
        {
            get
            {
                return this.chkShowPaperSettings.Checked;
            }
        }
    }
}

